package com.bjsxt.livegoods.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Product implements Serializable {
    private String id;
    private String title;
    private String   price;//价格，单位是元
    private String rentType;//租赁形式，整租，合租
    private String houseType; //房屋面积
    /**
     * 房屋特征
     * years-建造年份
     * type 房屋类型
     * level 房屋楼层
     * style 装修方式
     * orientation-朝向，朝南，
     */
    private Map<String,Object> info;
    //图片
    private List<String> imgs;
    //房屋所在城市
    private String city;
    //租赁次数
    private int rentCount;
    //推荐级别。默认1.数字越大，推荐级别越高
    private int recommendationLevel=1;
    //可以出租的时间
    private Date salesTime;
    //状态， 1-已出租； 2-未出租
    private String status="2";

    public Date getSalesTime() {
        return salesTime;
    }

    public void setSalesTime(Date salesTime) {
        this.salesTime = salesTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public int getRecommendationLevel() {
        return recommendationLevel;
    }

    public void setRecommendationLevel(int recommendationLevel) {
        this.recommendationLevel = recommendationLevel;
    }

    public int getRentCount() {
        return rentCount;
    }

    public void setRentCount(int rentCount) {
        this.rentCount = rentCount;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Product() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getRentType() {
        return rentType;
    }

    public void setRentType(String rentType) {
        this.rentType = rentType;
    }

    public String getHouseType() {
        return houseType;
    }

    public void setHouseType(String houseType) {
        this.houseType = houseType;
    }

    public Map<String, Object> getInfo() {
        return info;
    }

    public void setInfo(Map<String, Object> info) {
        this.info = info;
    }

    public String getImg(){
        return imgs.get(0);
    }
    public void setImg(String img){

    }
    //获取商品详情
    public String getLink(){
        return "/details?id="+getId();
    }
    public void setLink(String link){}
    public List<String> getImgs() {
        return imgs;
    }

    public void setImgs(List<String> imgs) {
        this.imgs = imgs;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return Objects.equals(id, product.id) && Objects.equals(title, product.title) && Objects.equals(price, product.price) && Objects.equals(rentType, product.rentType) && Objects.equals(houseType, product.houseType) && Objects.equals(info, product.info) && Objects.equals(imgs, product.imgs);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, price, rentType, houseType, info, imgs);
    }

    @Override
    public String toString() {
        return "Product{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", price=" + price +
                ", rentType='" + rentType + '\'' +
                ", houseType='" + houseType + '\'' +
                ", info=" + info +
                ", imgs=" + imgs +
                '}';
    }


}
